<?php

  //////////////////////////////////////////////////////////////////
  // OrbitFAQ                                                     //
  // ---------                                                    //
  //                                                              //
  // Orbit FAQ was solely written and developed by Orbit Services //
  // http://www.orbitservices.net                                 //
  //                                                              //
  // Access the Forum here:                                       //
  // http://forums.orbitservices.net/index.php?c=4                //
  //                                                              //
  // OrbitFAQ utilises the following opensource projects/classes; //
  //  + Fckeditor - http://www.fckeditor.net                      //
  //  + Smarty Template Engine - http://smarty.php.net            //
  //  + Swift Email Class - http://www.swiftmailer.org/           //
  //  + OWASP PHP Filter Project - http://www.owasp.org           //
  //  + MySQL Search Class by Stephen Bartholomew                 //
  //                                                              //
  //////////////////////////////////////////////////////////////////

  require('incs/config.inc.php');
  require('incs/db.inc.php');
  require('incs/classes.inc.php');

  if($GatherUserStats == '1')
    {
      require('incs/stats.inc.php');
    }

  // Lets get our common $_GET values and sanitize them
  $faq = sanitize_paranoid_string($_GET['faq']); // Selected FAQ
  $ca = sanitize_paranoid_string($_GET['ca']); // Category
  $qn = sanitize_paranoid_string($_GET['qn']); // Question
  $view = sanitize_paranoid_string($_GET['view']); // View Type
  $action = sanitize_paranoid_string($_GET['action']); // Action
  $redirect = $_GET['redirect']; // Redirect

  $smarty = new Smarty;

  $smarty->assign("FaqAddress","$FaqAddress");
  $smarty->assign("RssTitle","$RssTitle");
  $smarty->assign("RssDescription","$RssDescription");
  $smarty->assign("SiteTitle","$OrbitFAQTitle");
  $smarty->assign("faq","$faq");
  $smarty->assign("ca","$ca");
  $smarty->assign("view","$view");


  $SmartyCompileDir = "skins/$defaultSkin/skins_c";
  $smarty->compile_dir = $SmartyCompileDir;

  $smarty->compile_check = false;
  $smarty->debugging = false;

  // Lets get Top5 Lists
  require('incs/top5.inc.php');

  if($redirect != "")
    {

      $pieces = explode(",", $redirect);
      $rssFAQ = $pieces[0]; // FAQ
      $rssCategory = $pieces[1]; // Category
      $rssQuestion = $pieces[2]; // Question

      header("Location: $FaqAddress/index.php?faq=$rssFAQ&ca=$rssCategory#qn$rssQuestion");
      exit;

    }

  header("Content-type: text/xml");

  // Load our Listing Template
  $template_file = "../../skins/$defaultSkin/rss.tpl";
  $smarty->display("file:$template_file");

  clearSmartyCompiled($SmartyCompileDir, $ClearSmartyCompiled);

  if($RssShowQuery == '1')
    {
      ?>
        <!-- <?=$RssSQL;?> -->
      <?php
    }
?>